Presenting DevLib, a multimedia framework!
Why this article
Hugi #28 contained an article by Gongo/Green about OpenUDS. Its goal was to provide a generic C++ framework used to write demos, featuring the following:
- crosscompiler
- crossplatform
- wrapper for OpenGL and D3D
- rendertree for sequencing
- a framework in the first place and a few applications that work with this framework in the second place
When watching at the corresponding sourceforge project, it looks as the project is still at stage 0.
What is DevLib
After one year of programming on a such kind of project¸ I (Arnaud Storq, a.k.a. NoRecess from CONDENSE demogroup) decided to release my work onto the open-source community.
At this time, DevLib features the following:
- DevCpp and VC7 compatibility
- Fonts management: TrueType/Bitmap formats
- Image: Read/Write PNG/JPG/TGA/BMP formats
- Mesh: Read/Write MSH/X formats
- RenderSystem: complete support for DirectX/OpenGL APIs
- Resource: Read/Write Local/ZipArchive
- SoundSystem: Play MP3/OGG/WAV/XM/MOD..
- Video: Play MPG formats
- XML: Read/Write, DOM-based
In addition to that, the following is available:
- a website, with forum, snapshots, news, download, links sections
- a documentation: API-reference made using Doxygen, and 18 simple tutorials explaining each DevLib features.
- development support through the website's forum
Look at the following code. It displays at the center of the window the content of an image (image.png) extracted from an archive (myFile.zip).
#include "DevLib.h"
// let's assume Texture *m_texture; is declared in MyApp class
MyApp::MyApp( )
{
}
MyApp::~MyApp( )
{
}
void MyApp::create( )
{
ResourceReader *resourceReader
= ResourceReaderZip::createReader( "myFile.zip" );
ResourceManager::setReader( resourceReader );
m_texture = Texture::createTexture( false, "image.png" );
delete resourceReader;
}
void MyApp::displayUpdate( float elapsedTime )
{
// compute the center position of the texture
// getWidth and getHeight return the size of the RenderSystem
int xCenter = ( ( getWidth( ) - m_texture->getWidth( ) ) / 2;
int yCenter = ( ( getHeight( ) - m_texture->getHeight( ) ) / 2;
m_texture->render( xCenter, yCenter );
}
void MyApp::keyPress( Key key )
{
}
void MyApp::release( )
{
delete m_texture;
}
Additional note: MyApp derives from a base class being a render system. DevLib provides OpenGL and DirectX implementations.
The choice of a specified render system is made on compilation.
DevLib for demoscene?
DevLib handles many demoscene-related features: render-to-texture, dynamic/static vertex/index/texture buffers, sound handling through FMOD sound- system, MPG video decoding, single-pass multi-texturing, bitmap and truetype fonts, zip archives…
In addition to that, you are not limited when using DevLib. If you are, then just extends DevLib with your own implementations on file-systems, mesh-readers, image-readers, etc etc! Some 'hack' methods are also available to extend DirectX (such as GetDevice() and so on..) and OpenGL (you can directly use the context!). This is described in the DevLib documentation!
More information about DevLib!
Yeah, you just found this small presentation interesting? Join the DevLib community on the DevLib website: www.devlib-central.org.
This is my present to the demoscene.
Arnaud Storq
www.devlib-central.org
norecess@devlib-central.org
(visit also http://norecess.planet-d.net!)